package com.yf.zzmusic.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 我喜欢，注意需要有逻辑删除，用来恢复
 * </p>
 *
 * @author
 * @since 2024-03-07
 */
@Getter
@Setter
@TableName("collect")
public class Collect implements Serializable {

  private static final long serialVersionUID = 1L;

  @TableId(value = "collect_id", type = IdType.AUTO)
  private Integer collectId;

  /**
   * 用户id
   */
  @NotNull(message = "用户id不可为空")
  private Integer userId;

  /**
   * 音乐id
   */
  @NotNull(message = "音乐id不可为空")
  private Integer targetId;

  /**
   * 创建时间
   */
  private LocalDateTime createTimer;

  public Long getCreateTimer() {
    if (createTimer!=null){
      long timestamp = createTimer.toInstant(ZoneOffset.of("+8")).toEpochMilli();
      return timestamp;
    }else{
      return null;
    }
  }

  public void setCreateTimer(LocalDateTime createTimer) {
    this.createTimer = createTimer;
  }

  /**
   * 是否逻辑删除，默认为0表示没有删除，1表示删除
   */
  private Integer isDelete;


}
